CREATE TABLE [agency].[Agent]
(
[AgentId] [int] NOT NULL IDENTITY(1, 1),
[CompanyId] [int] NOT NULL,
[Code] [int] NOT NULL,
[AspnetUserId] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ReportingTo] [int] NOT NULL,
[FirstName] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[LastName] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DisplyName] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DateOfJoin] [datetime] NOT NULL,
[Active] [bit] NOT NULL,
[Deleted] [bit] NOT NULL,
[CreatedBy] [int] NOT NULL,
[CreatedOn] [datetime] NOT NULL,
[ModifiedBy] [int] NULL,
[ModifiedOn] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [agency].[Agent] ADD CONSTRAINT [PK_Agent] PRIMARY KEY CLUSTERED  ([AgentId]) ON [PRIMARY]
GO
ALTER TABLE [agency].[Agent] ADD CONSTRAINT [FK_Agent_Agent] FOREIGN KEY ([ReportingTo]) REFERENCES [agency].[Agent] ([AgentId])
GO
